package com.my_musc_service.controller;

import com.my_musc_service.common.annotation.EncryptField;
import com.my_musc_service.common.annotation.EncryptMethod;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import static com.my_musc_service.common.enums.EncryptConstant.DECRYPT;

/**
 * @author Zhu Dunfeng
 * @date 2021/8/20 9:42
 */
@Slf4j
@RequestMapping("encrypt")
@Controller
public class EncryptController {


    @ResponseBody
    @EncryptMethod
    @RequestMapping(value = "en")
    public String testEncry(
            @EncryptField
            @RequestParam(value="name")String name){
        System.out.println("name:========"+name);
        log.info("name:========"+name);
        return name;

    }

    @ResponseBody
    @EncryptMethod(type = DECRYPT)
    @GetMapping("dencry")
    public String testGetDencry(){
        return "lk/j7lzZpg+dkAkY107HDD11Jt5MmIc5";
    }


}
